API Documentation
Public Member Functions | List of all members
nkImages::Image Class Referencefinal

Holds all information required for an image, with ownership over the data. More...

Inheritance diagram for nkImages::Image:
nkImages::ImageBase

Public Member Functions

 Image ()
 
 Image (nkMemory::Buffer &&data)
 
 Image (nkMemory::Buffer &&data, unsigned int width, unsigned int height, unsigned int depth, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize=0, unsigned int rowByteSize=0, unsigned int sliceByteSize=0)
 
 Image (nkMemory::Buffer &&data, unsigned int width, unsigned int height, unsigned int depth, unsigned int arraySize, unsigned int mips, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize=0)
 
 Image (nkMemory::Buffer &&data, nkMemory::BufferCast< ImageDescriptor > &&images, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize, bool alphaPremultiplied=false, bool cubeMap=false)
 
 Image (const Image &other)
 
 Image (Image &&other)
 
 ~Image ()
 
virtual unsigned char * getDataPtr () const override
 
virtual unsigned long long getDataByteSize () const override
 
virtual nkMemory::BufferView getDataBuffer () const override
 
const nkMemory::BuffergetData () const
 
Imageoperator= (const Image &other)
 
Imageoperator= (Image &&other)
 
- Public Member Functions inherited from nkImages::ImageBase
 ImageBase ()
 
 ImageBase (unsigned int width, unsigned int height, unsigned int depth, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize=0, unsigned int rowByteSize=0, unsigned int sliceByteSize=0)
 
 ImageBase (unsigned int width, unsigned int height, unsigned int depth, unsigned int arraySize, unsigned int mips, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize=0)
 
 ImageBase (nkMemory::BufferCast< ImageDescriptor > &&images, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize, bool alphaPremultiplied=false, bool cubeMap=false)
 
 ImageBase (const ImageBase &other)
 
 ImageBase (ImageBase &&other)
 
virtual ~ImageBase ()
 
unsigned int getWidth (unsigned int mip=0) const
 
unsigned int getHeight (unsigned int mip=0) const
 
unsigned int getDepthOrArraySize (unsigned int mip=0) const
 
unsigned int getMipCount () const
 
PIXEL_FORMAT getFormat () const
 
unsigned int getPixelByteSize () const
 
unsigned int getRowByteSize (unsigned int mip=0) const
 
unsigned int getSliceByteSize (unsigned int mip=0) const
 
bool getAlphaPremultiplied () const
 
bool getCubeMap () const
 
bool isArray () const
 
void setFormat (PIXEL_FORMAT value)
 
void setPixelOrBlockByteSize (unsigned int value)
 
void setAlphaPremultiplied (bool value)
 
void setCubeMap (bool value)
 
nkMaths::Vector getPixel (unsigned int x, unsigned int y, unsigned int z=0, unsigned int mip=0)
 
Image decompress (const AlignmentDescriptor &alignmentDescriptor=AlignmentDescriptor())
 
ImageBaseoperator= (const ImageBase &other)
 
ImageBaseoperator= (ImageBase &&other)
 

Detailed Description

Holds all information required for an image, with ownership over the data.

See ImageBase for more information.

Constructor & Destructor Documentation

◆ Image() [1/7]

nkImages::Image::Image ( )

Default constructor.

◆ Image() [2/7]

nkImages::Image::Image ( nkMemory::Buffer &&  data)

Data-move constructor.

Parameters
dataThe buffer which data should be part of the image.

◆ Image() [3/7]

nkImages::Image::Image ( nkMemory::Buffer &&  data,
unsigned int  width,
unsigned int  height,
unsigned int  depth,
PIXEL_FORMAT  format,
unsigned int  pixelOrBlockByteSize = 0,
unsigned int  rowByteSize = 0,
unsigned int  sliceByteSize = 0 
)

2D image without mips constructor.

Parameters
dataThe buffer which data should be part of the image.
widthThe width of the image, in pixels.
heightThe height of the image, in pixels.
depthThe depth of the image, in number of slices of width * height images.
formatThe format of the image.
pixelOrBlockByteSizeThe size of a pixel or block, in bytes. Defaults to 0 to be automatically derived from the format.
rowByteSizeThe size of a row, in bytes. Defaults to 0 to be automatically derived from the pixel byte size and width.
sliceByteSizeThe size of a slice, in bytes. Defaults to 0 to be automatically derived from the row size size and height.

◆ Image() [4/7]

nkImages::Image::Image ( nkMemory::Buffer &&  data,
unsigned int  width,
unsigned int  height,
unsigned int  depth,
unsigned int  arraySize,
unsigned int  mips,
PIXEL_FORMAT  format,
unsigned int  pixelOrBlockByteSize = 0 
)

Tightly packed full constructor. Will derive all information for slices and mips based on width, height, depth and format given / pixelOrBlockSize given. Memory will be assumed as being tightly packed (no padding inside).

Parameters
dataThe buffer which data should be part of the image.
widthThe width of the image, in pixels.
heightThe height of the image, in pixels.
depthThe depth of the image, in number of slices of width * height images.
arraySizeThe number of slice in the image array.
mipsThe number of mips for each image slice.
formatThe pixel format of the image.
pixelOrBlockByteSizeThe size of a pixel or block, in bytes. Defaults to 0 to be automatically derived from the format.

◆ Image() [5/7]

nkImages::Image::Image ( nkMemory::Buffer &&  data,
nkMemory::BufferCast< ImageDescriptor > &&  images,
PIXEL_FORMAT  format,
unsigned int  pixelOrBlockByteSize,
bool  alphaPremultiplied = false,
bool  cubeMap = false 
)

Full constructor.

Parameters
dataThe buffer which data should be part of the image.
imagesThe sub-images constituting the full image. One entry corresponds to an entry within a 2D image array.
formatThe pixel format of the image.
pixelOrBlockByteSizeThe size of a pixel or block, in bytes.
alphaPremultipliedWhether the alpha is premultiplied (true) or not (false).
cubeMapWhether the image is a cube map (true) or not (false).

◆ Image() [6/7]

nkImages::Image::Image ( const Image other)

Copy constructor. Will make a copy of the data.

Parameters
otherThe image to copy from.

◆ Image() [7/7]

nkImages::Image::Image ( Image &&  other)

Move constructor. Will move the data over.

Parameters
otherThe image to move.

◆ ~Image()

nkImages::Image::~Image ( )

Destructor.

Member Function Documentation

◆ getDataPtr()

virtual unsigned char* nkImages::Image::getDataPtr ( ) const
overridevirtual
Returns
A pointer over the image data.

Implements nkImages::ImageBase.

◆ getDataByteSize()

virtual unsigned long long nkImages::Image::getDataByteSize ( ) const
overridevirtual
Returns
The total byte size of the image buffer.

Implements nkImages::ImageBase.

◆ getDataBuffer()

virtual nkMemory::BufferView nkImages::Image::getDataBuffer ( ) const
overridevirtual
Returns
A view over the image buffer.

Implements nkImages::ImageBase.

◆ getData()

const nkMemory::Buffer& nkImages::Image::getData ( ) const
Returns
A reference over the internal buffer holding the image data.

◆ operator=() [1/2]

Image& nkImages::Image::operator= ( const Image other)

Copy assignment operator.

Parameters
otherThe image to copy and assign.

◆ operator=() [2/2]

Image& nkImages::Image::operator= ( Image &&  other)

Move assignment operator.

Parameters
otherThe image to move and assign.

The documentation for this class was generated from the following file: